package github.sf.mod.calculate.entity;

import java.math.BigDecimal;

/**
 * 数字类表达式
 */
public class NumberLiteral extends Expression {
    private BigDecimal value;

    public NumberLiteral(String value) {
        this.value = new BigDecimal(value);
    }

    public BigDecimal getValue() {
        return value;
    }

    public void setValue(BigDecimal value) {
        this.value = value;
    }

    @Override
    public Object accept(AstVisitor visitor, Object additional) {
        return visitor.visitNumberLiteral(this, additional);
    }

    @Override
    public void dump(int index) {
        int newIndex = index + 1;
        System.out.println(" " + this);
    }

    @Override
    public String toString() {
        return "NumberLiteral{" +
                "value=" + value +
                '}';
    }
}
